home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / demos / 26 / pascal / bnchmk.txt next >
Encoding:
Text File  |  1986-06-19  |  5.7 KB  |  183 lines

  1.  
  2.            Benchmarking Atari ST Personal Pascal (OSS, Inc.)
  3.          versus IBM PC AT Turbo Pascal (Borland International)
  4.  
  5.  
  6.  
  7. As soon as I purchased Personal Pascal (V1.01) for my 1040 ST, I ran
  8. some simple benchmarks on it against our IBM PC AT at my office.
  9. Our AT is equipped with a speed-switcher to increase the clock rate
  10. from the normal 6 MHz to 8MHz.  Since this is a fairly common item,
  11. and because newer ATs are set up to run at 8 MHz, I included these
  12. times in the test as well.
  13.  
  14. All tests on the PC AT were run in Borland Turbo Pascal (Version 3.01),
  15. the de facto standard for MS-DOS Pascal.  Because Turbo Pascal defaults
  16. are for range, pointer, and debugging checking turned off, they were turned
  17. off for the Personal Pascal versions as well.  Times on the AT were
  18. measured using the hardware timers; I used a handheld stopwatch for the
  19. ST, but hopefully they are fairly accurate.  All tests on the ST were
  20. compiled for TOS.
  21.  
  22. The Sieve benchmark is the standard test which everybody seems to run
  23. on all machines, and it primarily tests integer math operations (actually
  24. only integer addition).  The fibonacci benchmark tests the recursion code
  25. efficiency of the compiler.  The float benchmark is a test of the efficiency
  26. of the simple floating point operations (+,-,*,/) directly supported
  27. by the CPU.  The trig/transcendental benchmark measures the efficiency
  28. of some of the trigonometric and transcendental library functions
  29. supported by the compiler.
  30.  
  31. I don't claim that these benchmarks are especially definitive, but
  32. they do seem to prove that the Atari ST is extremely competitive with
  33. the IBM PC AT in terms of a Pascal programming environment, particularly
  34. for scientific/engineering applications involving floating point math.
  35. The code for each of the tests follows the table summary.
  36.  
  37.                                         -- Kirk Pennywitt  [74116,3222] --
  38.  
  39.  
  40.  
  41.  
  42.                             PASCAL BENCHMARK SUMMARY
  43.                             ========================
  44.  
  45.                    ATARI ST         PC AT (6 MHz)           PC AT (8 MHz)
  46.                  ---------------------------------------------------------
  47. Sieve               6.1 sec.           5.38 sec.               3.95 sec.
  48. Fibonacci          23.6 sec.          23.67 sec.              17.36 sec.
  49. Floating Point     10.1 sec.          14.56 sec.              10.71 sec.
  50. Trig/Transc.       14.1 sec.          16.31 sec.              11.98 sec.
  51.  
  52.                   Atari ST OSS Personal Pascal (V1.01) versus
  53.                     IBM PC AT Borland Turbo Pascal (V3.01).
  54.  
  55.  
  56. -------------------------------------------------------------------------------
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. {$R-,D-,P-}
  69.  
  70. (* Erastosthenes Sieve Prime Number Program *)
  71. (* Tests integer math *)
  72.  
  73. program prime;
  74. const
  75.   size = 8190;
  76. var
  77.   flags : array [0..size] of boolean;
  78.   i,prime,k,count,iter : integer;
  79. begin
  80.   writeln('10 iterations');
  81.   for iter := 1 to 10 do begin
  82.         count := 0;
  83.         for i := 0 to size do
  84.                 flags[i] := true;
  85.         for i := 0 to size do
  86.                 if flags[i] then begin
  87.                         prime := i+i+3;
  88.                         {writeln(prime);}
  89.                         k := i+prime;
  90.                         while k <= size do begin
  91.                                 flags[k] := false;
  92.                                 k := k + prime
  93.                         end;
  94.                         count := count + 1
  95.                 end;
  96.   end;
  97.   writeln(count,' primes.')
  98. end.
  99.  
  100. { Runs in approx 6.1 sec. on Atari ST (Personal Pascal). }
  101. { Runs in 5.38 sec. on IBM PC AT @ 6 MHz. (Turbo Pascal). }
  102. { Runs in 3.95 sec. on IBM PC AT @ 8 MHz. (Turbo Pascal). }
  103.  
  104. -------------------------------------------------------------------------------
  105.  
  106. {$R-,D-,P-}
  107.  
  108. program fibo;  { Tests recursion }
  109. const
  110.   ntimes = 10;
  111.   number = 23;
  112. var
  113.   i, value : integer;
  114. function fibo(x : integer) : integer;
  115. begin
  116.   if x>2 then fibo := (fibo(x-1) + fibo(x-2))
  117.   else fibo := 1;
  118. end;  { of function fibo }
  119. begin
  120.   writeln(ntimes,' iterations.');
  121.   for i := 1 to ntimes do value := fibo(number);
  122.   writeln('fibonacci(',number,') = ',value);
  123. end.
  124.  
  125.  { Runs in approx. 23.6 sec on Atari ST (Personal Pascal). }
  126.  { Runs in 23.67 sec. on IBM PC AT @ 6 Mhz. (Turbo Pascal). }
  127.  { Runs in 17.36 sec. on IBM PC AT @ 8 MHz. (Turbo Pascal). }
  128.  
  129. -------------------------------------------------------------------------------
  130.  
  131.  
  132.  
  133.  
  134. {$D-,R-,P-}
  135.  
  136. program float;  { Tests floating point operations }
  137. var
  138.         a, b, c : real;
  139.         i       : integer;
  140. begin
  141.         writeln('10000 iterations.');
  142.         a := 3.1415926;
  143.         b := 5.1234548;
  144.  
  145.         for i := 1 to 10000 do begin
  146.             c := a * b;
  147.             b := a / c;
  148.             a := b + c;
  149.             c := a - b;
  150.         end;
  151.         writeln('Done.');
  152. end.
  153.  
  154. { Runs in approx. 10.1 sec. on Atari ST (Personal Pascal). }
  155. { Runs in 14.56 sec. on IBM PC AT @ 6 MHz. (Turbo Pascal). }
  156. { Runs in 10.71 sec. on IBM PC AT @ 8 MHz. (Turbo Pascal). }
  157.  
  158. -------------------------------------------------------------------------------
  159.  
  160. {$D-,R-,P-}
  161.  
  162. program trig_trans;  { Tests trig and transcendental libraries}
  163. var
  164.         a, b, c : real;
  165.         i       : integer;
  166. begin
  167.         writeln('1000 iterations.');
  168.         a := 3.1415926;
  169.         b := 5.1234548;
  170.  
  171.         for i := 1 to 1000 do begin
  172.             c := ln(a);
  173.             c := exp(b);
  174.             c := sin(a);
  175.             c := cos(b);
  176.         end;
  177.         writeln('Done.');
  178. end.
  179.  
  180. { Runs in approx. 14.1 sec. on Atari ST (Personal Pascal). }
  181. { Runs in 16.31 sec. on IBM PC AT @ 6 MHz. (Turbo Pascal). }
  182. { Runs in 11.98 sec. on IBM PC AT @ 8 MHz. (Turbo Pascal). }
  183.